<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>wickr-crypto-c: Key Exchange</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">wickr-crypto-c
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Key Exchange</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Public key exchange protected data. After a shared secret is generated using a public key with identifier 'key_id', and run through a KDF, it is used to encrypt data to be protected by the exchange and the ciphertext is stored in 'exchange_ciphertext'.  <a href="structwickr__key__exchange.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga1b6944bcbf28bae1312189d44628de3c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#ga1b6944bcbf28bae1312189d44628de3c">wickr_key_exchange_create</a> (<a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *exchange_id, uint64_t key_id, <a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *exchange_ciphertext)</td></tr>
<tr class="separator:ga1b6944bcbf28bae1312189d44628de3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2235a7c168e3806aa1a71b5a5c8dee48"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#ga2235a7c168e3806aa1a71b5a5c8dee48">wickr_key_exchange_copy</a> (const <a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *source)</td></tr>
<tr class="separator:ga2235a7c168e3806aa1a71b5a5c8dee48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga54b6481f8f4b61fb949bec17d47cd3de"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#ga54b6481f8f4b61fb949bec17d47cd3de">wickr_key_exchange_destroy</a> (<a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> **exchange)</td></tr>
<tr class="separator:ga54b6481f8f4b61fb949bec17d47cd3de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga907d700b76b748f80796b4404c7172c2"><td class="memItemLeft" align="right" valign="top">wickr_exchange_array_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#ga907d700b76b748f80796b4404c7172c2">wickr_exchange_array_new</a> (uint32_t exchange_count)</td></tr>
<tr class="separator:ga907d700b76b748f80796b4404c7172c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad3c6687c07ae5e66efcbc55da0febd85"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#gad3c6687c07ae5e66efcbc55da0febd85">wickr_exchange_array_set_item</a> (wickr_exchange_array_t *array, uint32_t index, <a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *exchange)</td></tr>
<tr class="separator:gad3c6687c07ae5e66efcbc55da0febd85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga333510c3c7eeb8e33f94495de6bb122d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#ga333510c3c7eeb8e33f94495de6bb122d">wickr_exchange_array_fetch_item</a> (wickr_exchange_array_t *array, uint32_t index)</td></tr>
<tr class="separator:ga333510c3c7eeb8e33f94495de6bb122d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacd04405337871aa3bcd550a051d778e1"><td class="memItemLeft" align="right" valign="top">wickr_array_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#gacd04405337871aa3bcd550a051d778e1">wickr_exchange_array_copy</a> (wickr_exchange_array_t *array)</td></tr>
<tr class="separator:gacd04405337871aa3bcd550a051d778e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadc1e5f5836bc09c1d6b8d6203d02a0eb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wickr__key__exchange.html#gadc1e5f5836bc09c1d6b8d6203d02a0eb">wickr_exchange_array_destroy</a> (wickr_exchange_array_t **array)</td></tr>
<tr class="separator:gadc1e5f5836bc09c1d6b8d6203d02a0eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="gacd04405337871aa3bcd550a051d778e1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacd04405337871aa3bcd550a051d778e1">&#9670;&nbsp;</a></span>wickr_exchange_array_copy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">wickr_array_t* wickr_exchange_array_copy </td>
          <td>(</td>
          <td class="paramtype">wickr_exchange_array_t *&#160;</td>
          <td class="paramname"><em>array</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">array</td><td>the array to copy </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated key exchange array that contains deep copies of the items from 'array' </dd></dl>

</div>
</div>
<a id="gadc1e5f5836bc09c1d6b8d6203d02a0eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadc1e5f5836bc09c1d6b8d6203d02a0eb">&#9670;&nbsp;</a></span>wickr_exchange_array_destroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wickr_exchange_array_destroy </td>
          <td>(</td>
          <td class="paramtype">wickr_exchange_array_t **&#160;</td>
          <td class="paramname"><em>array</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">array</td><td>a pointer to the array to destroy, all items of '*array' are also destroyed </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga333510c3c7eeb8e33f94495de6bb122d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga333510c3c7eeb8e33f94495de6bb122d">&#9670;&nbsp;</a></span>wickr_exchange_array_fetch_item()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a>* wickr_exchange_array_fetch_item </td>
          <td>(</td>
          <td class="paramtype">wickr_exchange_array_t *&#160;</td>
          <td class="paramname"><em>array</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>index</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Fetch a key exchange from an exchange array</p>
<p>NOTE: Calling this function does not make a copy of the exchange being returned, the array still owns it</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">array</td><td>the array to fetch 'index' from </td></tr>
    <tr><td class="paramname">index</td><td>the index to fetch from 'array' </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a key exchange representing 'index' from the array </dd></dl>

</div>
</div>
<a id="ga907d700b76b748f80796b4404c7172c2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga907d700b76b748f80796b4404c7172c2">&#9670;&nbsp;</a></span>wickr_exchange_array_new()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">wickr_exchange_array_t* wickr_exchange_array_new </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>exchange_count</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Allocate a new key exchange array</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">exchange_count</td><td>the number of exchanges the array should hold </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated wickr_array for key exchange objects </dd></dl>

</div>
</div>
<a id="gad3c6687c07ae5e66efcbc55da0febd85"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad3c6687c07ae5e66efcbc55da0febd85">&#9670;&nbsp;</a></span>wickr_exchange_array_set_item()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool wickr_exchange_array_set_item </td>
          <td>(</td>
          <td class="paramtype">wickr_exchange_array_t *&#160;</td>
          <td class="paramname"><em>array</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *&#160;</td>
          <td class="paramname"><em>exchange</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set an item in a key exchange array</p>
<p>NOTE: Calling this function does not make a copy of 'exchange', the array simply takes ownership of it</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">array</td><td>the array to set 'exchange' into </td></tr>
    <tr><td class="paramname">index</td><td>the location in 'array' to set exchange </td></tr>
    <tr><td class="paramname">exchange</td><td>the exchange to set at position 'index' in 'array' </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if setting succeeds, false if the index is out of bounds </dd></dl>

</div>
</div>
<a id="ga2235a7c168e3806aa1a71b5a5c8dee48"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2235a7c168e3806aa1a71b5a5c8dee48">&#9670;&nbsp;</a></span>wickr_key_exchange_copy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a>* wickr_key_exchange_copy </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> *&#160;</td>
          <td class="paramname"><em>source</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Copy a key exchange</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>the key exchange to copy </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated node holding a deep copy of the properties of 'source' </dd></dl>

</div>
</div>
<a id="ga1b6944bcbf28bae1312189d44628de3c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1b6944bcbf28bae1312189d44628de3c">&#9670;&nbsp;</a></span>wickr_key_exchange_create()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a>* wickr_key_exchange_create </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__buffer.html">wickr_buffer_t</a> *&#160;</td>
          <td class="paramname"><em>exchange_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>key_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *&#160;</td>
          <td class="paramname"><em>exchange_ciphertext</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create a key exchange from properties</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">exchange_id</td><td>see '<a class="el" href="structwickr__key__exchange.html" title="Public key exchange protected data. After a shared secret is generated using a public key with identi...">wickr_key_exchange</a>' property documentation property documentation </td></tr>
    <tr><td class="paramname">key_id</td><td>see '<a class="el" href="structwickr__key__exchange.html" title="Public key exchange protected data. After a shared secret is generated using a public key with identi...">wickr_key_exchange</a>' property documentation property documentation </td></tr>
    <tr><td class="paramname">exchange_ciphertext</td><td>see '<a class="el" href="structwickr__key__exchange.html" title="Public key exchange protected data. After a shared secret is generated using a public key with identi...">wickr_key_exchange</a>' property documentation property documentation </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated packet metadata set owning the properties passed in </dd></dl>

</div>
</div>
<a id="ga54b6481f8f4b61fb949bec17d47cd3de"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga54b6481f8f4b61fb949bec17d47cd3de">&#9670;&nbsp;</a></span>wickr_key_exchange_destroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wickr_key_exchange_destroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structwickr__key__exchange.html">wickr_key_exchange_t</a> **&#160;</td>
          <td class="paramname"><em>exchange</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Destroy a key exchange</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">exchange</td><td>a pointer to the key exchange to destroy. All properties of '*exchange' will also be destroyed </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
